var _Page;

function _defineProperty(a, t, e) {
    return t in a ? Object.defineProperty(a, t, {
        value: e,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : a[t] = e, a;
}

var app = getApp();

Page((_defineProperty(_Page = {
    data: {
        _is_load: !0,
        cardid: 0,
        avater: "",
        avaterImg: "",
        address: "定位您的位置",
        industryid: 0,
        industryname: ""
    },
    onLoad: function(a) {
        var e = this;
        app.util.getUserInfo(function(a) {
            var t = this;
            e.setData({
                userInfo: a,
                avatar: a.memberInfo.avatar,
                nickname: a.memberInfo.nickname
            }), e.data.userInfo.memberInfo.nickname || (app.globalData.userInfo ? this.setData({
                userInfo2: app.globalData.userInfo,
                avatar: app.globalData.userInfo.avatarUrl,
                nickname: app.globalData.userInfo.nickName,
                hasUserInfo: !0
            }) : this.data.canIUse ? app.userInfoReadyCallback = function(a) {
                t.setData({
                    userInfo2: a.userInfo,
                    avatar: a.userInfo.avatarUrl,
                    hasUserInfo: !0
                });
            } : wx.getUserInfo({
                success: function(a) {
                    app.globalData.userInfo = a.userInfo, t.setData({
                        userInfo2: a.userInfo,
                        avatar: a.userInfo.avatarUrl,
                        hasUserInfo: !0
                    });
                }
            }));
        }), wx.login({
            success: function(a) {
                var t = a.code;
                app.util.request({
                    url: "entry/wxapp/openid",
                    data: {
                        m: "bbyscm_card",
                        code: t
                    },
                    success: function(a) {
                        a.data.openid;
                        e.setData({
                            session_key: a.data.session_key
                        });
                    }
                });
            }
        });
        var t = a.cardid;
        e.setData({
            cardId: t
        }), 0 < t ? app.util.request({
            url: "entry/wxapp/GetCard",
            data: {
                m: "bbyscm_card",
                cardid: t
            },
            success: function(a) {
                0 == a.data.errno && e.setData({
                    card_info: a.data.data,
                    cardid: a.data.data.id,
                    avatar: a.data.data.avater,
                    mobile: a.data.data.mobile,
                    address: a.data.data.address,
                    industry: a.data.data.industry,
                    cardname: a.data.data.cardname,
                    industryname: a.data.data.industryname,
                    industryid: a.data.data.industry,
                    _is_load: !1
                });
            }
        }) : e.setData({
            _is_load: !1
        }), app.util.request({
            url: "entry/wxapp/Setup",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                e.setData({
                    setup: a.data.data,
                    apikey: a.data.data.apikey
                });
            }
        }), app.util.request({
            url: "entry/wxapp/GetIndustry",
            data: {
                m: "bbyscm_card"
            },
            success: function(a) {
                e.setData({
                    industry: a.data.data,
                    indusname: a.data.data.name
                });
            }
        });
    },
    getPhoneNumber: function(a) {
        var t = this, e = t.data.session_key, n = a.detail.iv, s = a.detail.encryptedData;
        app.util.request({
            url: "entry/wxapp/Phone",
            data: {
                m: "bbyscm_card",
                sessionKey: e,
                iv: n,
                data: s
            },
            success: function(a) {
                t.setData({
                    mobile: a.data.phoneNumber
                });
            }
        });
    },
    open_map_chonse: function() {
        var t = this;
        wx.chooseLocation({
            type: "gcj02",
            success: function(a) {
                t.setData({
                    longitude: a.longitude,
                    latitude: a.latitude,
                    address: a.address
                });
            },
            fail: function(a) {
                t.setData({
                    fail2: !0
                });
            },
            complete: function(a) {
                new (require("../../../utils/qqmap-wx-jssdk.js"))({
                    key: t.data.apikey
                }).reverseGeocoder({
                    location: {
                        latitude: t.data.latitude,
                        longitude: t.data.longitude
                    },
                    success: function(a) {
                        t.setData({
                            region: a.result.address_component,
                            province: a.result.address_component.province,
                            city: a.result.address_component.city,
                            county: a.result.address_component.district,
                            title: a.result.address_reference.town.title,
                            street_number: a.result.address_component.street_number,
                            recommend: a.result.formatted_addresses.recommend
                        });
                    },
                    fail: function(a) {},
                    complete: function(a) {}
                });
            }
        });
    },
    onShareAppMessage: function() {},
    onReady: function() {},
    modifyAvater: function() {
        var n = this, s = n.data.avater;
        n.data.avaterImg;
        wx.chooseImage({
            count: 1,
            sizeType: [ "original", "compressed" ],
            sourceType: [ "album", "camera" ],
            success: function(a) {
                var e = a.tempFilePaths;
                wx.showToast({
                    title: "正在上传...",
                    icon: "loading",
                    duration: 1e4
                });
                var t = app.util.url("entry/wxapp/WxUpload");
                wx.uploadFile({
                    url: t + "m=bbyscm_card",
                    filePath: e[0],
                    name: "file",
                    formData: {},
                    success: function(a) {
                        var t = a.data;
                        "string" == typeof t && (t = JSON.parse(t.trim())), 0 == t.errno ? (s = e[0], n.setData({
                            avater: s,
                            avaterImg: t.data
                        })) : wx.showToast({
                            title: t.message,
                            icon: "success",
                            duration: 2e3
                        });
                    },
                    complete: function() {
                        wx.hideToast();
                    }
                });
            }
        });
    },
    onShow: function() {
        var a = this.data.cardId;
        this.setData({
            yzm_all_time: 60,
            cardid: a,
            _btn_disabled: _btn_disabled,
            avater: this.data.userInfo.memberInfo.avatarUrl
        });
    },
    bindInputBlur: function(a) {
        this.inputValue = a.detail.value;
    },
    bindButtonTap: function() {
        var t = this;
        wx.chooseVideo({
            sourceType: [ "album", "camera" ],
            maxDuration: 60,
            camera: [ "front", "back" ],
            success: function(a) {
                t.setData({
                    videosrc: a.tempFilePath
                });
            }
        });
    },
    postCard: function(a) {
        var t = this;
        t.setData({
            btn_disabled: !0,
            submitIsLoading: !0
        }), JSON.stringify(a.detail.value);
        var e = a.detail.formId, n = a.detail.value.cardname, s = t.data.userInfo.memberInfo.gender, o = a.detail.value.mobile, i = a.detail.value.company, d = a.detail.value.business, r = t.data.userInfo.memberInfo.nickname, c = t.data.cardid, u = t.data.address, l = a.detail.value.job, m = t.data.longitude, f = t.data.latitude, p = t.data.province, b = t.data.city, y = t.data.county, v = t.data.street, h = t.data.street_number, g = t.data.industryid, _ = "";
        return _ = t.data.avaterImg ? t.data.avaterImg : t.data.userInfo.memberInfo.avatar, 
        n ? o ? i ? g ? void ("定位您的位置" != u && "" != u ? (wx.showToast({
            title: "提交中...",
            icon: "loading",
            duration: 1e4
        }), app.util.request({
            url: "entry/wxapp/PostCard",
            data: {
                m: "bbyscm_card",
                cardid: c,
                cardname: n,
                sex: s,
                username: r,
                mobile: o,
                company: i,
                address: u,
                job: l,
                business: d,
                avatarUrl: _,
                longitude: m,
                latitude: f,
                province: p,
                city: b,
                county: y,
                street: v,
                street_number: h,
                industry: g,
                form_id: e
            },
            method: "POST",
            success: function(a) {
                0 == a.data.errno ? wx.showModal({
                    title: "提示",
                    content: "提交成功",
                    showCancel: !1,
                    success: function(a) {
                        wx.navigateBack();
                    }
                }) : wx.showModal({
                    title: "提示",
                    content: a.data.message,
                    showCancel: !1,
                    success: function(a) {
                        a.confirm;
                    }
                });
            },
            fail: function(a) {
                wx.showModal({
                    title: "提示",
                    content: a.data.message,
                    showCancel: !1,
                    success: function(a) {
                        a.confirm;
                    }
                });
            },
            complete: function() {
                wx.hideToast();
            }
        })) : wx.showModal({
            title: "提示",
            content: "请定位您的位置",
            showCancel: !1,
            success: function(a) {
                a.confirm, t.setData({
                    btn_disabled: !1,
                    submitIsLoading: !1
                });
            }
        })) : (wx.showModal({
            title: "提示",
            content: "请选择行业",
            showCancel: !1,
            success: function(a) {
                a.confirm, t.setData({
                    btn_disabled: !1,
                    submitIsLoading: !1
                });
            }
        }), !1) : (wx.showModal({
            title: "提示",
            content: "请填写您的公司名称",
            showCancel: !1,
            success: function(a) {
                a.confirm, t.setData({
                    btn_disabled: !1,
                    submitIsLoading: !1
                });
            }
        }), !1) : (wx.showModal({
            title: "提示",
            content: "请获取手机号",
            showCancel: !1,
            success: function(a) {
                a.confirm, t.setData({
                    btn_disabled: !1,
                    submitIsLoading: !1
                });
            }
        }), !1) : (wx.showModal({
            title: "提示",
            content: "请填写您的姓名",
            showCancel: !1,
            success: function(a) {
                a.confirm, t.setData({
                    btn_disabled: !1,
                    submitIsLoading: !1
                });
            }
        }), !1);
    },
    onHide: function() {},
    onUnload: function() {},
    onPullDownRefresh: function() {},
    onReachBottom: function() {}
}, "onShareAppMessage", function() {}), _defineProperty(_Page, "industryid", function(a) {
    a.target.dataset.id;
    this.setData({
        condition: !this.data.condition,
        industryid: a.target.dataset.id,
        industryname: a.target.dataset.name
    });
}), _defineProperty(_Page, "open", function() {
    this.setData({
        condition: !this.data.condition
    });
}), _defineProperty(_Page, "onNavigateTap", function(a) {
    wx.openSetting({});
    this.setData({
        fail2: !1
    });
}), _defineProperty(_Page, "bindGetUserInfo", function(a) {
    wx.navigateBack();
}), _Page));